package com.dianping.cat.consumer.cross.model.transform;
import com.dianping.cat.consumer.cross.model.entity.CrossReport;
import com.dianping.cat.consumer.cross.model.entity.Local;
import com.dianping.cat.consumer.cross.model.entity.Name;
import com.dianping.cat.consumer.cross.model.entity.Remote;
import com.dianping.cat.consumer.cross.model.entity.Type;
import java.util.ArrayList;
import java.util.List;

public class DefaultLinker implements ILinker {
  private boolean m_deferrable;

  public DefaultLinker(boolean deferrable) {
/* 14 */     this.m_deferedJobs = new ArrayList();


/* 17 */     this.m_deferrable = deferrable;
  }
  private List<Runnable> m_deferedJobs;
  public void finish() {
/* 21 */     for (Runnable job : this.m_deferedJobs) {
/* 22 */       job.run();
    }
  }


  public boolean onLocal(final CrossReport parent, final Local local) {
/* 28 */     if (this.m_deferrable) {
/* 29 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 32 */               parent.addLocal(local);
            }
          });
    } else {
/* 36 */       parent.addLocal(local);
    }

/* 39 */     return true;
  }


  public boolean onName(final Type parent, final Name name) {
/* 44 */     if (this.m_deferrable) {
/* 45 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 48 */               parent.addName(name);
            }
          });
    } else {
/* 52 */       parent.addName(name);
    }

/* 55 */     return true;
  }


  public boolean onRemote(final Local parent, final Remote remote) {
/* 60 */     if (this.m_deferrable) {
/* 61 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 64 */               parent.addRemote(remote);
            }
          });
    } else {
/* 68 */       parent.addRemote(remote);
    }

/* 71 */     return true;
  }


  public boolean onType(Remote parent, Type type) {
/* 76 */     parent.setType(type);
/* 77 */     return true;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/cross/model/transform/DefaultLinker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */